//
//  ThreeTableViewCell.m
//  DZZTravel
//
//  Created by 赵国栋 on 16/7/16.
//  Copyright © 2016年 Eason. All rights reserved.
//

static NSString *const kCffier = @"glm";

#import "ThreeTableViewCell.h"
#import "passValueForCell.h"
@interface ThreeTableViewCell ()<UICollectionViewDataSource,UICollectionViewDelegate>
@property (nonatomic ,strong)UICollectionView *collection;
@property (nonatomic ,strong)NSMutableArray *array;
@end

@implementation ThreeTableViewCell
- (NSMutableArray *)array{
    if (!_array) {
        _array = [NSMutableArray array];
    }
    return _array;
}

- (void)awakeFromNib {
    [self creatCollectView];
    [self creatCell];
    
}
- (void)creatCell{
    
    [RequestManager fectDataWithUrl:[NSString stringWithFormat:@"http://apiphp.yaochufa.com/portal/scenic/ScenicDetail430?channel=AppStore&id=%@&imei=3BB694A0-037E-406A-8F2B-0852448416B6&lang=app&machineCode=3BB694A0-037E-406A-8F2B-0852448416B6&machineType=0&system=ios&version=5.2.3",[passValueForCell shareDefalut].cityID] parameter:@{} method:@"GET" compelet:^(NSData *data) {
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
        NSArray *array =dic[@"content"][@"strategyList"];
        
        for (NSDictionary *dccc in array) {
//             self.array addObject:dccc[@""]
        }
      
        
    } upDateUI:^{
        [self.collection reloadData];
        
    }];
    
    
    
}



- (void)creatCollectView{
    UICollectionViewFlowLayout *flow = [UICollectionViewFlowLayout new];
    flow.itemSize = CGSizeMake(231, 231);
    self.collection =[[UICollectionView alloc]initWithFrame:self.contenV.bounds collectionViewLayout:flow];
    
    flow.scrollDirection =  UICollectionViewScrollDirectionHorizontal;
    [self.collection registerClass:[OBCollectionViewCell class] forCellWithReuseIdentifier:kCffier];
    
    self.collection.backgroundColor = [UIColor cyanColor];
    self.collection.pagingEnabled = NO;

    
    self.collection.delegate  = self;
    self.collection.dataSource = self;
    [self.contenV addSubview:self.collection];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 10;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    OBCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kCffier forIndexPath:indexPath];
    cell.lable.text = @"123";
    cell.backgroundColor = [UIColor cyanColor];
    return cell;
}

@end
